{extend name="../../admin/view/main"}
{block name="content"}
<style>
    .ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_sw{
        right:-3px!important;
        width:702px!important;
    }
</style>
<form action="{:sysuri()}" method="post" data-auto="true" class="layui-form layui-card">
    <div class="layui-card-body padding-left-40">
        <div class="layui-row layui-col-space15 margin-bottom-5">
            <div class="layui-col-xs12 padding-bottom-0">
                <label class="relative block">
                    <span class="help-label"><b>检索为空提示</b> APPID</span>
                    <input name="null_tips" placeholder="请输入检索商品为空提示" value="{:sysconf('null_tips')?:'此书在仓库，暂未上架，请联系客服，微信添加朋友→企业微信联系人:13260236583'}" class="layui-input">
                </label>
            </div>
            <div class="layui-col-xs12 padding-bottom-0">
                <label class="relative block">
                    <span class="help-label"><b>VIP会员规则</b> Remark</span>
                    <textarea name="vip_agreement" cols="2" rows="2" style="height:200px!important;overflow-y:scroll;" placeholder="请输入VIP会员规则" class="layui-textarea">{:sysconf('vip_agreement')?:'VIP会员规则'}</textarea>
                </label>
            </div>
            <div class="layui-col-xs12 padding-bottom-0">
                <label class="relative block">
                    <span class="help-label"><b>用户中心规则</b> Remark</span>
                    <textarea name="user_agreement" style="height:200px!important;overflow-y:scroll;" placeholder="请输入用户中心规则" class="layui-textarea">{:sysconf('user_agreement')?:'用户中心规则'}</textarea>
                </label>
            </div>
            <div class="layui-col-xs12 padding-bottom-0">
                <label class="relative block">
                    <span class="help-label"><b>联系我们</b> Connect</span>
                    <textarea name="connect_us" style="height:200px!important;overflow-y:scroll;" placeholder="请输入联系我们内容" class="layui-textarea">{:sysconf('connect_us')?:'联系我们'}</textarea>
                </label>
            </div>
            <div class="layui-col-xs12 padding-bottom-0">
                <label class="relative block">
                    <span class="help-label"><b>关于我们</b> About_us</span>
                    <textarea name="about_us" style="height:200px!important;overflow-y:scroll;" placeholder="请输入关于我们内容" class="layui-textarea">{:sysconf('about_us')?:'关于我们'}</textarea>
                </label>
            </div>
        </div>
    </div>

    <div class="hr-line-dashed"></div>
    <div class="layui-form-item text-center">
        <button id="vip_agreement123" class="layui-btn layui-btn-xs margin-left-15" type="button">预览VIP会员规则</button>
        <button id="user_agreement123" class="layui-btn layui-btn-xs margin-left-15" type="button">预览用户中心规则</button>
        <button id="connect_us" class="layui-btn layui-btn-xs margin-left-15" type="button">预览联系我们</button>
        <button id="about_us" class="layui-btn layui-btn-xs margin-left-15" type="button">预览关于我们</button>
        <button class="layui-btn layui-btn-xs" type="submit">保存配置</button>
    </div>
</form>
<script>
    $(function(){
      require(['ckeditor'], function () {
        window.createEditor('[name=vip_agreement]', {height: 150})
        window.createEditor('[name=user_agreement]', {height: 150})
        window.createEditor('[name=connect_us]', {height: 150})
        window.createEditor('[name=about_us]', {height: 150})
      });
      $('#vip_agreement123').click( function () {
            var contents = $('[name=vip_agreement]').val();
            gopreview(contents)
        });
      $('#user_agreement123').click( function () {
            var contents = $('[name=user_agreement]').val();
            gopreview(contents)
        });
      $('#connect_us').click( function () {
            var contents = $('[name=connect_us]').val();
            gopreview(contents)
        });
      $('#about_us').click( function () {
            var contents = $('[name=about_us]').val();
            gopreview(contents)
        });
      $("form").parents(".layui-layer-content").css("height","500px")
      $("form").parents(".layui-layer-content").css("overflow-y","scroll")
    })
    function gopreview(contents){
        $.ajax({
                url:'/index/index/preview',
                type:'POST',
                data:{
                    'content':contents
                },
                success:function(data){
                    if(data.code == 1){
                        layui.layer.open({
                            type: 1, shade: false, title: '预览',
                            content: '<div class="text-center padding-20"><img src="'+data.data+'" width="200"></div>'
                        });
                    }else{
                        layer.msg(data.info);
                        return false;
                    }
                }
            })
    }
</script>


{/block}
